package ioperation;

import book.BookList;

import java.util.Scanner;

public class ReturnBook implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("输入你要归还的图书: ");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getUsedSize(); i++) {
            if(bookList.books[i].getName().equals(name)) {
                bookList.books[i].setBorrowed(false);
                System.out.println("归还成功");
                return;
            }
        }
    }
}
